home *** CD-ROM | disk | FTP | other *** search
- /* A new and improved fopen that makes MPW text files. */
-
- /* This should only be compiled and linked under MPW - note that config.h
- must *not* be included, or "mpw_fopen" will call itself! */
-
- #ifdef MPW
-
- #include <StdIO.h>
- #include <Files.h>
-
- FILE *
- mpw_fopen(name, mode)
- char *name, *mode;
- {
- char *pname = (char *) malloc(strlen(name) + 2);
- OSErr e;
- FILE *fp;
- struct FInfo fi;
-
- pname[0] = strlen(name);
- strcpy(pname+1, name);
-
- fp = fopen(name, mode);
-
- e = GetFInfo(pname, 0, &fi);
- /* should do spiffier error handling */
- if (e != 0) printf("%d\n", e);
- fi.fdType = (OSType) 'TEXT';
- fi.fdCreator = (OSType) 'MPS ';
- e = SetFInfo(pname, 0, &fi);
- if (e != 0) printf("%d\n", e);
- return fp;
- }
-
- #endif /* MPW */
-